//导入Vue核心包
import Vue from 'vue';

//导入APP.vue的vue对象
import App from './App.vue';

//将vue-router集成到这个项目中来
import vueRouter from 'vue-router';

//vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);

//导入路由规则对象的组件对象
import home from './components/Home.vue';
import shopcar from './components/shopcar/car.vue';
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import picturelist from './components/picture/picturelist.vue';
import pictureinfo from './components/picture/pictureinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue';

//定义路由规则
var router = new vueRouter({
	linkActiveClass:'mui-active',
	routes:[
		{path:'/',redirect:'/home'},	//默认跳转到首页
		{path:'/home',component:home},	//首页
		{path:'/shopcar/car',component:shopcar},	//购物车
		{path:'/news/newslist',component:newslist},	//新闻列表
		{path:'/news/newslist/:id',component:newsinfo},	//列表详情
		{path:'/picture/picturelist',component:picturelist},	//图片列表
		{path:'/picture/pictureinfo/:id',component:pictureinfo},	//缩略图
		{path:'/goods/goodslist',component:goodslist},	//商品列表
		{path:'/goods/goodsinfo/:id',component:goodsinfo},	//商品列表
		{path:'/goods/goodsdesc/:id',component:goodsdesc},	//商品图文介绍
		{path:'/goods/goodscomment/:id',component:goodscomment}	//商品的评论
	]
})

//导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';

//注册mint-ui
import mintui from 'mint-ui';
Vue.use(mintui);

//导入mui的css样式
import '../statics/mui/css/mui.css';

//导入系统全局基本样式
import '../statics/css/site.css';


//导入vue-resource对象，vue-resource对象绑定到Vue对象上后会自动生成$http,能进行ajax请求
import vueResource from 'vue-resource';
Vue.use(vueResource);

//日期过滤器
import moment from 'moment';
Vue.filter('datefmt',function(input,fmtstring){
	return moment(input).format(fmtstring);
});

//导入图片预览组件
import VuePreview from 'vue-preview';
Vue.use(VuePreview);

//利用Vue对象进行解析渲染
new Vue({
	el:'#app',
	//使用路由对象实例
	router,
	render:c=>c(App) //es6函数写法  => goes to
	//render：function(create){create(App)}
})